﻿<!DOCTYPE html>
<html>
<head>    
    <title>Freemium Applications Helper for WebMatrix - Helper Reference</title>
    <link href="content/site.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
    <div class="container">
        <div class="header">
            <img src="content/images/webx-icon.png" alt="WebMatrix" />
            <h1> WebMatrix Helpers</h1>
            <h2>Freemium Applications Helper - Reference</h2>
        </div>
        <div class="content">
        <div class="navLinks">
            <a href="startHere.htm">Start Here</a> | <a href="reference.htm">Helper Reference</a>
        </div>            
        <h3>Helper Methods</h3>			
            <table class="memberdecls">
            <tr>
                <td class="memItemLeft">static void</td>
                <td class="memItemRight" ><b>Initialize</b> (string databaseName, [bool createBaseDataSet], [string signUpPageUrl])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight">Initializes the Freemium helper. You can specify the sign up page where to redirect users that cannot access a specific feature. If createBaseDataSet is set to true a base set of stock-keeping
                    units and features will be created automatically in this database</td>
              </tr>
              <tr>
                <td class="memItemLeft">static bool</td>
                <td class="memItemRight" ><strong>IsFeatureEnabledForCurrentUser</strong> (string featureName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Returns if a feature is enabled for the current user</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static bool</td>
                <td class="memItemRight"><strong>IsFeatureEnabledForUser</strong> (string featureName, string userName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight">Returns if a feature is enabled for a given user</td>
              </tr>
              <tr>
                <td class="memItemLeft">static  bool</td>
                <td class="memItemRight"><strong>IsFeatureEnabledForStockKeepingUnit</strong> (string featureName, string skuName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight">Returns if a feature is enabled for a given SKU.</td>
              </tr>
              <tr>
                <td class="memItemLeft">static  void</td>
                <td class="memItemRight"><strong>RequireFeatureEnabledForCurrentPage</strong> (string featureName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight">Validates if the current user has acceess to the current page. If not, the user is redirected to the Sign Up page</td>
              </tr>
              <tr>
                <td class="memItemLeft">static  bool</td>
                <td class="memItemRight"><strong>ExistsStockKeepingForRole</strong> (string rolename)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Checks if an associated SKU exists for the given role</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static IEnumerable&lt;<a href="#Feature">Feature</a>&gt;</td>
                <td class="memItemRight" ><strong>GetAllFeatures</strong>()</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves all the features</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static IEnumerable&lt;<a href="#Sku">SKU</a>&gt;</td>
                <td class="memItemRight" ><strong>GetAllStockKeepingUnits</strong>()</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves all the SKUs</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static IEnumerable&lt;<a href="#Feature">Feature</a>&gt;</td>
                <td class="memItemRight" ><strong>GetAllFeaturesForStockKeepingUnit</strong> (string skuName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves all the enabled features for a SKU</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static IEnumerable&lt;<a href="#Sku">SKU</a>&gt;</td>
                <td class="memItemRight" ><strong>GetAllStockKeepingUnitsForFeature</strong> (string featureName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves all the SKUs where a feature is enabled</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static <a href="#Feature">Feature</a></td>
                <td class="memItemRight" ><strong>GetFeature</strong> (string featureName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves a feature</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static <a href="#Sku">SKU</a></td>
                <td class="memItemRight" ><strong>GetStockKeepingUnit</strong> (string skuName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves a SKU</td>
              </tr>
                <tr>
                <td class="memItemLeft"> static byte[]</td>
                <td class="memItemRight" ><strong>GetStockKeepingUnitImage</strong> (
string skuName, 
[string imageCssClass])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Retrieves the image of the specified Stock Keeping Unit.</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>CreateFeature</strong> (string name, string description)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Creates a new Feature</td>
              </tr>
              <tr>
                <td class="memItemLeft">static void</td>
                <td class="memItemRight" ><strong>UpdateFeature</strong> (string featureName, string description)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Updates a feature</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>RemoveFeature</strong> (string featureName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Removes a feature</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>RemoveStockKeepingUnit</strong> (string skuSName)</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Removes a SKU</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>CreateStockKeepingUnit</strong> (string name, string description, decimal price, [byte[] image])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Creates a new SKU</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>UpdateStockKeepingUnit</strong> (string name, string description, decimal price, bool updateImage, [byte[] image])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Updates a SKU</td>
              </tr>
               <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>UpdateFeatureForStockKeepingUnit</strong> ()</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Enables or disables a feature for a SKU</td>
              </tr>
              <tr>
                <td class="memItemLeft"> static void</td>
                <td class="memItemRight" ><strong>UpdateFeatureByStockKeepingUnitMatrix</strong> ()</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Updates the SKU/Features matrix using the data in the submited Form</td>
              </tr>           
              <tr>
                <td class="memItemLeft">@helper</td>
                <td class="memItemRight" ><strong>GetFeatureByStockKeepingUnitMatrixHtml</strong> ([string tableCssClass],
[string enabledCssClass],
[string disabledCssClass],
[string editFeaturePageUrl],
[string editSkuPageUrl],
[bool allowEdit],
[bool includeFormTag],
[string saveText])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Shows the SKU/Features matrix, to display which features are enabled in each SKU</td>
              </tr>
              <tr>
                <td class="memItemLeft">@helper</td>
                <td class="memItemRight" ><strong>GetStockKeepingUnitsListHtml</strong> ([string itemContainerCssClass],
[string itemCssClass],
[string signUpForSkuPageUrl],
[Func&lt;dynamic, object&gt; template])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Shows the SKUs offered by your web site as an HTML list (ul). This method supports passing an inline template parameter to customize the look and feel of each SKU in the list.</td>
              </tr>
              <tr>
                <td class="memItemLeft">@helper</td>
                <td class="memItemRight" ><strong>GetStockKeepingUnitImageHtml</strong> (
string skuName, 
[string imageCssClass])</td>
              </tr>
              <tr>
                <td class="mdescLeft">&nbsp;</td>
                <td class="mdescRight" >Shows an HTML image tag for the SKU image</td>
              </tr>
              <tr><td class="memItemLeft"></td><td class="memItemRight"></td></tr>
          </table>                     
            <h4 id="Feature">
                Feature</h4>
            <table class="memberdecls">
                <tr>
                    <td width="163" class="memItemRight">
                        int <strong>Id</strong>
                    </td>
                    <td width="625" class="memItemRight">
                        The feature ID.
                    </td>
                </tr>
                <tr>
                    <td class="memItemRight">
                        string <strong>Name</strong>
                    </td>
                    <td class="memItemRight">
                        The feature name.
                    </td>
                </tr>
                <tr>
                    <td class="memItemRight">
                        string <strong>Description</strong>
                    </td>
                    <td class="memItemRight">
                        The feature description.
                    </td>
                </tr>
            </table>
            <h4 id="Sku">
                SKU (Stock Keeping Unit)</h4>
            <table class="memberdecls">
                <tr>
                    <td width="163" class="memItemRight">
                        int <strong>Id</strong>
                    </td>
                    <td width="625" class="memItemRight">
                        The Stock Keeping Unit ID.
                    </td>
                </tr>
                <tr>
                    <td class="memItemRight">
                        string <strong>Name</strong>
                    </td>
                    <td class="memItemRight">
                        The Stock Keeping Unit name.
                    </td>
                </tr>
                <tr>
                    <td class="memItemRight">
                        string <strong>Description</strong>
                    </td>
                    <td class="memItemRight">
                        The Stock Keeping Unit description.
                    </td>
                </tr>
                <tr>
                    <td class="memItemRight">
                        double <strong>Price</strong>
                    </td>
                    <td class="memItemRight">
                        The Stock Keeping Unit price.
                    </td>
                </tr>
            </table>
      </div>
        <ul class="footer">
        <li>We're always looking for <a href="mailto:webapp@microsoft.com">bugs, feedback and suggestions!</a></li>
            <li>&copy; 2010-2011 Microsoft Corporation. Powered by IIS Express.</li>
        </ul>
    </div>
</body>
</html>
